package tianrun.ziguan.api.calculate.config.service.template.module.impl;

import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import tianrun.ziguan.api.calculate.config.dao.TEdgeInputModuleMapper;
import tianrun.ziguan.api.calculate.config.entity.TEdgeInputModule;
import tianrun.ziguan.api.calculate.config.service.template.module.ITEdgeInputModuleService;
import tianrun.ziguan.api.common.util.ListUtil;

import java.util.Collections;
import java.util.List;
import java.util.Set;

@Service
public class ITEdgeInputModuleServiceImpl extends ServiceImpl<TEdgeInputModuleMapper, TEdgeInputModule> implements ITEdgeInputModuleService {

    @Override
    public List<TEdgeInputModule> getByIds(Set<Long> moduleIds) {
        if (ListUtil.isEmpty(moduleIds))return Collections.emptyList();
        return list(Wrappers.<TEdgeInputModule>lambdaQuery().in(TEdgeInputModule::getId,moduleIds));
    }

    @Override
    public List<TEdgeInputModule> getByTemplateIds(Set<Long> ids) {
        if (ListUtil.isEmpty(ids))return Collections.emptyList();
        return list(Wrappers.<TEdgeInputModule>lambdaQuery().in(TEdgeInputModule::getTemplateId,ids));
    }
}
